﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace InfFront.InfoSources.Base
{
    /// <summary>
    /// Base exception class
    /// </summary>
    public class Exception: ApplicationException
    {
        // Summary:
        //     Initializes a new instance of the InfFront.InfoSources.Base.Exception class.
        public Exception()
        {
        }

        //
        // Summary:
        //     Initializes a new instance of the InfFront.InfoSources.Base.Exception class with
        //     a specified error message.
        //
        // Parameters:
        //   message:
        //     A message that describes the error.
        public Exception(string message)
            : base(message)
        {
        }

        //
        // Summary:
        //     Initializes a new instance of the InfFront.InfoSources.Base.Exception class with
        //     a specified error message and a reference to the inner exception that is
        //     the cause of this exception.
        //
        // Parameters:
        //   message:
        //     The error message that explains the reason for the exception.
        //
        //   innerException:
        //     The exception that is the cause of the current exception. If the innerException
        //     parameter is not a null reference, the current exception is raised in a catch
        //     block that handles the inner exception.
        public Exception(string message, System.Exception innerException)
            : base(message, innerException)
        {
        }
    }

    /// <summary>
    /// InfoField processing exception
    /// </summary>
    public class InfoFieldException : Exception
    {
        private InfoField field;

        public InfoFieldException(InfoField field, string message)
            : base(message)
        {
            this.field = field;
        }

        public InfoFieldException(InfoField field, string message, System.Exception innerException)
            : base(message, innerException)
        {
            this.field = field;
        }

        public InfoField Field
        {
            get { return field; }
        }
    }

    /// <summary>
    /// InfoCommand processing exception
    /// </summary>
    public class InfoCommandException : Exception
    {
        private InfoCommand command;

        public InfoCommandException(InfoCommand cmd, string message)
            : base(message)
        {
            command = cmd;
        }

        public InfoCommandException(InfoCommand cmd, string message, System.Exception innerException)
            : base(message, innerException)
        {
            command = cmd;
        }

        public InfoCommand Command 
        { 
            get { return command; } 
        }
    }
}
